<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>JS异步加载图片</title>
  </head>
  <body></body>
  <script>
    function loadImage(src, resolve, reject) {
      let image = new Image();
      image.src = src;
      image.onload = () => {
        resolve(image);
      };
      image.onerror = reject;
    }
    loadImage(
      "images/原子表.png",
      (image) => {
        document.body.appendChild(image);
      },
      () => {
        console.log("加载失败");
      }
    );
    console.log("后盾人");
  </script>
</html>
